<?php
/**
 * User zgh
 * Email 1803897171@qq.com
 * Date 2021/7/30
 **/

namespace app\admin\service;

use app\admin\item\ItemLoader;
use app\common\model\SmsModel;

class SmsService
{
    public static function getList($params)
    {
        $pagination = filter_pagination(@$params['page'], @$params['limit']);
        $loader = new  ItemLoader();
        $where = $loader->addVal($params)->addWhereSearch("mobile","str",true)->loadWhere();
        $data = [];
        $query = SmsModel::where($where)->order(["id" => "desc"]);
        $data['total'] = $query->count();
        $data['dataList'] = [];
        if ($data['total']) {
            $data['dataList'] = $query->limit($pagination['start'], $pagination['limit'])->select()->toArray();
        }
        return $data;
    }
}